hi,
I want to call java script function when I make my control by inline code in mvc. Pls. help me.
Thanks.
home / developersection / forums / calling javascript function in asp.net mvc
hi,
I want to call java script function when I make my control by inline code in mvc. Pls. help me.
Thanks.
Chris Anderson
11-Oct-2011First create a java script function-->
Then call that function by using control which is made by inline code, as below:
<%:Html.DropDownListFor(x => x.SelectedProduct, new SelectList(Model.Products, "Value", "Text"), "Please Select a product", new { id = "dropDown1", onchange="selectedIndexChanged()" })%><%:Html.TextBoxFor(x => x.Name,new {id="txtName",onkeypress="ontextChanged()" })%>
Try it. This will help you.